<template>
	<!-- 我的班级 -->
	<view class="b-homelist">
		<block v-for="(item,index) in itemList" :key="index">
			<swipe-action @click="fnHandleClick" style="margin-bottom: 10px;" :actions="item.istch?actions:tt" :params="item">
				<template  v-slot:content>
					<view class="swipewrap">
						<image class="images" src="../../static/img/99.png"></image>
						<view class="right"> 
							<view class="wenzi">
								{{item.wk_className}}
							</view>
							<view class="i-btn" @click="fnNavgateTo(item)">
								 <view class="btn">打卡</view>
							</view>
						</view>
					</view>
				</template>
			</swipe-action>
		</block>
	</view>
</template>

<script>
	export default{
		props:{
			itemList:{
				type:Array,
				
			}
			
		},
		
		data(){
			return{
				tt:[{
						name: '退出',
						color: '#fff',
						value:'exit',
						fontsize: 30,//单位upx
						width: 80, //单位px
						//icon: 'like.png',//此处为图片地址
						background: '#ed3f14'
					}
				],
				actions: [
					{
						name: '结束',
						color: '#fff',
						value:'delete',
						fontsize: 30,
						width: 80,
						//icon: 'like.png',//此处为图片地址
						background: '#ff7900'
					}
				]
			}
		},
		
		
		methods:{
			fnHandleClick(e){
				this.$emit('click',e)
			},
			// fnGetClassList(){
			// 	console.log(88)
			// 	if(uni.getStorageSync("userInfo")){
			// 		let params={
			// 			userid:uni.getStorageSync("userInfo").userid
			// 		}
			// 		this.$fun.request(params,'php/xcx_getmyclasslist.php').then(res=>{
			// 			console.log(res)
			// 			this.ClassList=res.data
			// 		})
			// 	}
			// },
			fnNavgateTo(item){
				if(uni.getStorageSync("userInfo")){
					this.$store.state.classInfo=item
					uni.navigateTo({
						url:'../src/daka/daka'
					})
				}else{
					uni.navigateTo({
						url:'../mylogin/mylogin'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.b-homelist{
		width: 100%;
		//padding: 10px;
		//background-color: #2C405A;
		.swipewrap{
			width: 100%;
			//height: 100px;
			display: flex;
			padding: 10px;
			//background: #15BB31;
			align-items: center;
			
			.images{
				width: 70px;
				height: 70px;
				margin-right: 10px;
				//margin:0 10px;
			}
			.right{
				display: flex;
				flex: 1;
				justify-content: space-between;
				.wenzi{
					flex: 1;
					font-size: 14px;
					color: #505050;
					font-weight: 600;
					display: flex;
					align-items: center;
				//	background: #007AFF;
				}
				.btn{
					width: 50px;
					height: 25px;
					font-size: 12px;
					background-color: #ffad33;
					margin: 10px;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 5px;
					color: #fff;
					&:active{
						background-color: #ff9900;
					}
				}
				
			}
		}
		
	}
</style>
